﻿<Window x:Class="Brjnk.CoordinateSystem2D.Layers.PhotoWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="PhotoWindow"
        Width="300"
        Height="300"
        Background="Black"
        PreviewMouseWheel="Window_MouseWheel"
        ResizeMode="NoResize"
        Topmost="True"
        WindowStyle="None">
    <Grid>
        <Grid.Resources>
            <Pen x:Key="pen"
                 Brush="#FFFFFFFF"
                 Thickness="20" />
            <PathGeometry x:Key="arrowL">
                <PathFigure StartPoint="14,50">
                    <LineSegment Point="100,0" />
                    <LineSegment Point="100,100" />
                </PathFigure>
            </PathGeometry>
            <PathGeometry x:Key="arrowR">
                <PathFigure StartPoint="86,50">
                    <LineSegment Point="0,0" />
                    <LineSegment Point="0,100" />
                </PathFigure>
            </PathGeometry>

            <Storyboard x:Key="show">
                <DoubleAnimation Duration="0:0:0.3"
                                 Storyboard.TargetProperty="Opacity"
                                 To="1" />
            </Storyboard>
            <Storyboard x:Key="hide">
                <DoubleAnimation Duration="0:0:1.5"
                                 Storyboard.TargetProperty="Opacity"
                                 To="0" />
            </Storyboard>

            <Storyboard x:Key="highlight">
                <DoubleAnimation Duration="0:0:0.5"
                                 Storyboard.TargetProperty="Opacity"
                                 To="1" />
            </Storyboard>
            <Storyboard x:Key="unhighlight">
                <DoubleAnimation Duration="0:0:1.5"
                                 Storyboard.TargetProperty="Opacity"
                                 To="0.5" />
            </Storyboard>

            <Style x:Key="highlightStyle">
                <Style.Triggers>
                    <EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
                        <BeginStoryboard Storyboard="{StaticResource ResourceKey=highlight}" />
                    </EventTrigger>
                    <EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
                        <BeginStoryboard Storyboard="{StaticResource ResourceKey=unhighlight}" />
                    </EventTrigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>

        <Image Name="img"
               Grid.RowSpan="2"
               Grid.ColumnSpan="2"
               MouseDown="Image_MouseDown"
               Source="{Binding}" />

        <!--  Pravý horní roh  -->
        <StackPanel Grid.Column="1"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    Orientation="Horizontal">
            <!--  Fullscreen tlačítko  -->
            <Border Name="fullscreenBtn"
                    Width="16"
                    Height="16"
                    Margin="5"
                    MouseDown="fullscreenBtn_MouseDown"
                    Opacity="0.5"
                    Style="{StaticResource highlightStyle}">
                <Border.Background>
                    <DrawingBrush>
                        <DrawingBrush.Drawing>
                            <GeometryDrawing Brush="#80000000" Pen="{StaticResource pen}">
                                <GeometryDrawing.Geometry>
                                    <GeometryGroup>
                                        <LineGeometry StartPoint="0,33" EndPoint="0,0" />
                                        <LineGeometry StartPoint="0,0" EndPoint="33,0" />

                                        <LineGeometry StartPoint="66,0" EndPoint="100,0" />
                                        <LineGeometry StartPoint="100,0" EndPoint="100,33" />

                                        <LineGeometry StartPoint="100,66" EndPoint="100,100" />
                                        <LineGeometry StartPoint="100,100" EndPoint="66,100" />

                                        <LineGeometry StartPoint="33,100" EndPoint="0,100" />
                                        <LineGeometry StartPoint="0,100" EndPoint="0,66" />
                                    </GeometryGroup>
                                </GeometryDrawing.Geometry>
                            </GeometryDrawing>
                        </DrawingBrush.Drawing>
                    </DrawingBrush>
                </Border.Background>
            </Border>
            <!--  Zavírací tlačítko  -->
            <Border Name="closeBtn"
                    Width="16"
                    Height="16"
                    Margin="5"
                    MouseDown="closeBtn_MouseDown"
                    Opacity="0.5"
                    Style="{StaticResource highlightStyle}">
                <Border.Background>
                    <DrawingBrush>
                        <DrawingBrush.Drawing>
                            <GeometryDrawing Brush="Transparent" Pen="{StaticResource pen}">
                                <GeometryDrawing.Geometry>
                                    <GeometryGroup>
                                        <LineGeometry StartPoint="0,0" EndPoint="100,100" />
                                        <LineGeometry StartPoint="100,0" EndPoint="0,100" />
                                    </GeometryGroup>
                                </GeometryDrawing.Geometry>
                            </GeometryDrawing>
                        </DrawingBrush.Drawing>
                    </DrawingBrush>
                </Border.Background>
            </Border>
        </StackPanel>

        <!--  Posouvací šipky  -->
        <UniformGrid Grid.Row="1"
                     Height="50"
                     Background="Transparent"
                     Columns="2"
                     Opacity="0">
            <UniformGrid.Triggers>
                <EventTrigger RoutedEvent="MouseEnter">
                    <BeginStoryboard Storyboard="{StaticResource ResourceKey=show}" />
                </EventTrigger>
                <EventTrigger RoutedEvent="MouseLeave">
                    <BeginStoryboard Storyboard="{StaticResource ResourceKey=hide}" />
                </EventTrigger>
            </UniformGrid.Triggers>
            <!--  vlevo  -->
            <Border Name="previousBtn"
                    Width="32"
                    Height="32"
                    Margin="5"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Bottom"
                    MouseDown="previousBtn_MouseDown"
                    Opacity="0.5"
                    Style="{StaticResource highlightStyle}">
                <Border.Background>
                    <DrawingBrush>
                        <DrawingBrush.Drawing>
                            <GeometryDrawing Brush="#FFFFFFFF" Geometry="{StaticResource arrowL}" />
                        </DrawingBrush.Drawing>
                    </DrawingBrush>
                </Border.Background>
            </Border>
            <!--  vpravo  -->
            <Border Name="nextBtn"
                    Width="32"
                    Height="32"
                    Margin="5"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Bottom"
                    MouseDown="nextBtn_MouseDown"
                    Opacity="0.5"
                    Style="{StaticResource highlightStyle}">
                <Border.Background>
                    <DrawingBrush>
                        <DrawingBrush.Drawing>
                            <GeometryDrawing Brush="#FFFFFFFF" Geometry="{StaticResource arrowR}" />
                        </DrawingBrush.Drawing>
                    </DrawingBrush>
                </Border.Background>
            </Border>
        </UniformGrid>
    </Grid>
</Window>